import request from '@/utils/request.js'

export function getRoles(params) {
  return request({
    url: '/sys/role',
    params
  })
}

export function getCompany(id) {
  return request({
    url: `/company/${id}`
  })
}

export function deleteRoles(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'DELETE'
  })
}

export function getRolesInfo(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

export function updateRoles(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'PUT',
    data
  })
}

export function addRole(data) {
  return request({
    url: `/sys/role`,
    method: 'POST',
    data
  })
}

// 给角色分配权限
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
